#ifndef MYGLWIDGET_H
#define MYGLWIDGET_H

#include "GL/glew.h"
#include <QGLWidget>
#include <QTimer>
#include "myFramework.h"
#include "App/AppBase.h"

class RayFrame::Camera;

/// QtWidget which actually get rendering events
class MyGLWidget : public QGLWidget, public RayFrame::FrameBase
{
	Q_OBJECT
public:
	explicit MyGLWidget(QWidget *parent = 0);
  virtual ~MyGLWidget();

  virtual void SwapBuffer(){};  // qt will swap buffer automaticlly
protected:
	void initializeGL();
	void paintGL();
	void resizeGL(int width, int height);
	
  MouseButton translateMouseBtn(QMouseEvent *event);
  void mousePressEvent(QMouseEvent *event);
  void mouseReleaseEvent(QMouseEvent *event);
	void mouseMoveEvent(QMouseEvent *event);

  void internalCreate();
  void internalDestroy();

protected:
  QTimer *timer;
signals:

	public slots:

};

#endif // MYGLWIDGET_H
